#include<stdio.h>
int BinarySearch(long long int a[], long long int n,long long int p) 
{
    long long int left=0,right=n-1;
    while(left<=right)
    {
        int  middle=(left+right)/2;
        if(a[middle]>p)
        {
            right=middle-1;
        }
        else if(a[middle]<p)
        {
            left=middle+1;
        }
        else 
        {
            return 1;
            break;
        }
    }
    return -1;
}
int main()
{
    long long n,q,a[100010],i,j,b[200010];
    scanf("%lld",&n);
    for(i=0;i<n;i++)
        scanf("%lld",&a[i]);
    scanf("%lld",&q);
    for(i=0;i<q;i++)
        scanf("%lld",&b[i]);
    for(i=0;i<q;i++)
    {
        if(BinarySearch(a,n,b[i])==1)
        {
            printf("1\n");
        }
        else
        {
            printf("0\n");
        }
    }
    return 0;
}